const fs = require("fs")

const reader = fs.createReadStream("./foo.txt", {
  start: 1,
  end: 10,
  highWaterMark: 20
})
reader.on("data", (data) => {
  console.log(data.toString('utf-8'));
  console.log(data);
  reader.pause()
  setTimeout(() => {
    reader.resume()
  }, 1000);
})
reader.on("open", () => {
  console.log("open");
})
reader.on("close", () => {
  console.log("close");
})